package com.ruoyi.qxk.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.qxk.api.RemoteRescueTypeService;
import com.ruoyi.qxk.api.domain.RescueType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteRescueTypeFallbackFactory implements FallbackFactory<RemoteRescueTypeService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteRescueTypeFallbackFactory.class);

    @Override
    public RemoteRescueTypeService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteRescueTypeService()
        {

            @Override
            public List<RescueType> getlist(String source) {
                return new ArrayList<>();
            }
        };
    }
}
